package com.example.springboottest.example.k8s;

import java.util.Arrays;
import java.util.List;

import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.PodList;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;

public class K8sClient {
    public static void main(String[] args) {
        KubernetesClient client = new DefaultKubernetesClient();
        // list pods in the default namespace
        PodList pods = client.pods().inNamespace("default").list();
        List<Pod> podList = pods.getItems();
        podList.stream().forEach(pod -> {
            System.out.println(pod.toString());

        });
    }
}
